package com.peng.kafka;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;

/**
 * SpringBootKafkaConsumer
 *
 * @author: lupeng6
 * @create: 2023/3/21 08:57
 */
// @Component
public class SpringBootKafkaConsumer {

    @KafkaListener(topics = {"sample2"}, groupId = "testGroup1")
    public void consume(ConsumerRecord<String, String> record, Acknowledgment ack) {
        System.out.printf("SpringBootKafkaConsumer key:%s value:%s%n", record.key(), record.value());
        ack.acknowledge();
    }
}
